class CreateMemberships < ActiveRecord::Migration
  def self.up
    create_table :memberships do |t|
      t.column "user_id", :integer, :null => false
      t.column "group_id", :integer, :null => false
      t.column "created_at", :datetime, :null => false
    end

    foreign_key :memberships, :user_id, :users
    foreign_key :memberships, :group_id, :groups

  end

  def self.down
    drop_table :memberships
  end
end
